<?php
namespace think;

require __DIR__ . '/../vendor/autoload.php';

use think\facade\Db; // 导入Db类
use think\facade\Env;
(new App())->console;

if (is_file('install.lock')) {
    exit('请勿重复更新');
}
$tableName = env('database.prefix', 'lnk_').'config';
$sql = "
UPDATE ".$tableName." SET type = REPLACE(type, 'lnksns', 'lnk');
";
Db::execute($sql);

$tableName = env('database.prefix', 'lnk_').'permissions';
$sql = "
UPDATE ".$tableName." SET route = REPLACE(route, 'lnksns', 'lnk'),component = REPLACE(component, 'lnksns', 'lnk');
";
Db::execute($sql);
file_put_contents('install.lock','');
echo '更新成功，请及时删除当前文件';